import { useEffect, useState } from "react";

function Demo () {
    const [count, setCount] = useState(0);
    useEffect(() => {
        console.log('hello world');
        console.log(count, 'count');
    }, []);
    // 初始化调用一次之后不会再执行，相当于componentDidMount
    return (
        <div>
            <button onClick={() => {setCount(count + 1)}}>click me</button>
            <div>hello world</div>
        </div>
    )
}

export default Demo;